package Form;

import java.awt.CardLayout;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.GridLayout;
import java.awt.Insets;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.util.Calendar;

import javax.swing.DefaultComboBoxModel;
import javax.swing.JComboBox;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;
import javax.swing.border.MatteBorder;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;

import Control.Workshop_Report_Controller;

@SuppressWarnings("serial")
public class Workshop_Report_Form extends JPanel{
	//Object Attributes
	private Main parser;
	private Workshop_Report_Controller control;
	private JLabel lblTitle;
	private JPanel cardPanel;
	private JComboBox monthCombo;
	private JScrollPane categoryScrollPane;
	private JPanel categoryPanel;
	private JTabbedPane tabbedPane;
	private JPanel productPanel;
	private JPanel productStatistics;
	private JPanel panel;
	private JLabel lblRightArrow;
	private JLabel lblSales;
	private JLabel lblLegend;
	private JLabel lblDecoKey;
	private JLabel lblDecorations;
	private JLabel lblHandiKey;
	private JLabel lblHandicrafts;
	private JLabel lblPotKey;
	private JLabel lblPottery;
	private JLabel lblSewKey;
	private JLabel lblSewing;
	private JPanel panel_1;
	private JPanel decoHolder;
	private JPanel panel_3;
	private JPanel handiHolder;
	private JPanel panel_5;
	private JPanel potHolder;
	private JPanel panel_7;
	private JPanel sewHolder;
	private JPanel panel_9;
	private JLabel lblDecoStat;
	private JLabel lblDecoStatDetails;
	private JLabel lblHandiStat;
	private JLabel lblHandiStatDetails;
	private JLabel lblPotStat;
	private JLabel lblPotStatDetails;
	private JLabel lblSewStat;
	private JLabel lblSewStatDetails;
	private JScrollPane itemScrollPane;
	private JPanel itemPanel;
	private JScrollPane workshopScrollPane;
	private JPanel workshopStatistics;
	private JPanel pastWorkshopsPanel;
	private JPanel labelPanel;
	private JLabel lblDeco;
	private JLabel lblHandi;
	private JLabel lblPot;
	private JLabel lblSew;
	private JLabel lblTopSelling;
	private JLabel lblProdName;
	private JLabel lblProdQuan;
	private JLabel lblProdUnitPrice;
	private JLabel lblProdTotalPrice;
	private JLabel lblCategory;
	
	public Main getParser() {
		return parser;
	}

	public void setParser(Main parser) {
		this.parser = parser;
	}

	public Workshop_Report_Controller getControl() {
		return control;
	}
	public void setControl(Workshop_Report_Controller control) {
		this.control = control;
	}
	
	public void refreshProductStatistics(){
		if(control != null){
			getLblDecoStat().setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[0] / (double)control.getReport().getTotalQuantity()) * 233), 24));
			getLblDecoStatDetails().setText("Qty: " + control.getReport().getQuantity()[0] + ", Total: $" + control.getReport().getSales()[0]);
			getLblHandiStat().setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[1] / (double)control.getReport().getTotalQuantity()) * 233), 24));
			getLblHandiStatDetails().setText("Qty: " + control.getReport().getQuantity()[1] + ", Total: $" + control.getReport().getSales()[1]);
			getLblPotStat().setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[2] / (double)control.getReport().getTotalQuantity()) * 233), 24));
			getLblPotStatDetails().setText("Qty: " + control.getReport().getQuantity()[2] + ", Total: $" + control.getReport().getSales()[2]);
			getLblSewStat().setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[3] / (double)control.getReport().getTotalQuantity()) * 233), 24));
			getLblSewStatDetails().setText("Qty: " + control.getReport().getQuantity()[3] + ", Total: $" + control.getReport().getSales()[3]);
		}
	}
	
	public Workshop_Report_Form(Main parser) {
		this.setParser(parser);
		this.setControl(new Workshop_Report_Controller(this));
		control.generateSalesReport();
		
		GridBagLayout gridBagLayout = new GridBagLayout();
		gridBagLayout.columnWidths = new int[] {30, 220, 160, 30, 190, 30};
		gridBagLayout.rowHeights = new int[] {50, 50, 395, 30, 0};
		gridBagLayout.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 1.0};
		gridBagLayout.rowWeights = new double[]{0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
		setLayout(gridBagLayout);
		GridBagConstraints gbc_lblTitle = new GridBagConstraints();
		gbc_lblTitle.anchor = GridBagConstraints.EAST;
		gbc_lblTitle.insets = new Insets(0, 0, 5, 5);
		gbc_lblTitle.gridx = 1;
		gbc_lblTitle.gridy = 1;
		add(getLblTitle(), gbc_lblTitle);
		GridBagConstraints gbc_monthCombo = new GridBagConstraints();
		gbc_monthCombo.insets = new Insets(0, 0, 5, 5);
		gbc_monthCombo.gridx = 2;
		gbc_monthCombo.gridy = 1;
		add(getMonthCombo(), gbc_monthCombo);
		GridBagConstraints gbc_lblCategory = new GridBagConstraints();
		gbc_lblCategory.anchor = GridBagConstraints.WEST;
		gbc_lblCategory.gridwidth = 2;
		gbc_lblCategory.insets = new Insets(0, 0, 5, 5);
		gbc_lblCategory.gridx = 3;
		gbc_lblCategory.gridy = 1;
		add(getLblCategory(), gbc_lblCategory);
		GridBagConstraints gbc_cardPanel = new GridBagConstraints();
		gbc_cardPanel.gridwidth = 2;
		gbc_cardPanel.insets = new Insets(0, 0, 5, 5);
		gbc_cardPanel.fill = GridBagConstraints.BOTH;
		gbc_cardPanel.gridx = 1;
		gbc_cardPanel.gridy = 2;
		add(getCardPanel(), gbc_cardPanel);
		GridBagConstraints gbc_tabbedPane = new GridBagConstraints();
		gbc_tabbedPane.insets = new Insets(0, 0, 5, 5);
		gbc_tabbedPane.fill = GridBagConstraints.BOTH;
		gbc_tabbedPane.gridx = 4;
		gbc_tabbedPane.gridy = 2;
		add(getTabbedPane(), gbc_tabbedPane);
	}

	public JLabel getLblTitle() {
		if (lblTitle == null) {
			lblTitle = new JLabel("Sales Report for");
			lblTitle.setFont(new Font("Tahoma", Font.PLAIN, 20));
		}
		return lblTitle;
	}
	public JPanel getCardPanel() {
		if (cardPanel == null) {
			cardPanel = new JPanel();
			cardPanel.setLayout(new CardLayout(0, 0));
			cardPanel.add(getProductStatistics(), "productStatistics");
			cardPanel.add(getItemScrollPane(), "items");
			cardPanel.add(getWorkshopStatistics(), "workshopStatistics");
		}
		return cardPanel;
	}
	public JComboBox getMonthCombo() {
		if (monthCombo == null) {
			monthCombo = new JComboBox();
			monthCombo.setFont(new Font("Tahoma", Font.PLAIN, 16));
			monthCombo.addActionListener(new ActionListener() {
				public void actionPerformed(ActionEvent arg0) {
					if(control != null){
						control.generateSalesReport();
						control.generateItems();
						control.generatePastWorkshops();
					}
				}
			});
			monthCombo.setModel(new DefaultComboBoxModel(new String[] {"January " + Calendar.getInstance().get(Calendar.YEAR), "February " + Calendar.getInstance().get(Calendar.YEAR), "March " + Calendar.getInstance().get(Calendar.YEAR), "April " + Calendar.getInstance().get(Calendar.YEAR), "May " + Calendar.getInstance().get(Calendar.YEAR), "June " + Calendar.getInstance().get(Calendar.YEAR), "July " + Calendar.getInstance().get(Calendar.YEAR), "August " + Calendar.getInstance().get(Calendar.YEAR), "September " + Calendar.getInstance().get(Calendar.YEAR), "October " + Calendar.getInstance().get(Calendar.YEAR), "November " + Calendar.getInstance().get(Calendar.YEAR), "December " + Calendar.getInstance().get(Calendar.YEAR)}));
		}
		return monthCombo;
	}
	public JScrollPane getCategoryScrollPane() {
		if (categoryScrollPane == null) {
			categoryScrollPane = new JScrollPane();
			categoryScrollPane.setBorder(null);
			categoryScrollPane.setPreferredSize(new Dimension(160, 250));
			categoryScrollPane.setViewportView(getCategoryPanel());
		}
		return categoryScrollPane;
	}
	public JPanel getCategoryPanel() {
		if (categoryPanel == null) {
			categoryPanel = new JPanel();
		}
		return categoryPanel;
	}
	public JTabbedPane getTabbedPane() {
		if (tabbedPane == null) {
			tabbedPane = new JTabbedPane(JTabbedPane.TOP);
			tabbedPane.addChangeListener(new ChangeListener() {
				public void stateChanged(ChangeEvent arg0) {
					if(tabbedPane.getSelectedIndex() == 0){
						getLblTitle().setText("Sales Report for");
						CardLayout cl = (CardLayout)(getCardPanel().getLayout());
					    cl.show(getCardPanel(), "productStatistics");
					}
					else if(tabbedPane.getSelectedIndex() == 1){
						getLblTitle().setText("Products Sold for");
						getLblCategory().setText("for " + control.getSelectedCategory().getDescription());
						CardLayout cl = (CardLayout)(getCardPanel().getLayout());
					    cl.show(getCardPanel(), "items");
					}
					else{
						getLblTitle().setText("Workshop Conduct for");
						getLblCategory().setText("for " + control.getSelectedCategory().getDescription());
						CardLayout cl = (CardLayout)(getCardPanel().getLayout());
					    cl.show(getCardPanel(), "workshopStatistics");
					}
				}
			});
			tabbedPane.addTab("Categories", null, getCategoryScrollPane(), null);
			tabbedPane.addTab("Products", null, getProductPanel(), null);
			tabbedPane.setEnabledAt(1, false);
			tabbedPane.addTab("Workshops", null, getWorkshopScrollPane(), null);
			tabbedPane.setEnabledAt(2, false);
		}
		return tabbedPane;
	}
	public JPanel getProductPanel() {
		if (productPanel == null) {
			productPanel = new JPanel();
			GridBagLayout gbl_productPanel = new GridBagLayout();
			gbl_productPanel.columnWidths = new int[] {0, 155, 0};
			gbl_productPanel.rowHeights = new int[] {40, 40, 40, 40, 40, 0};
			gbl_productPanel.columnWeights = new double[]{1.0, 0.0, 1.0};
			gbl_productPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
			productPanel.setLayout(gbl_productPanel);
			GridBagConstraints gbc_lblTopSelling = new GridBagConstraints();
			gbc_lblTopSelling.insets = new Insets(0, 0, 5, 5);
			gbc_lblTopSelling.gridx = 1;
			gbc_lblTopSelling.gridy = 0;
			productPanel.add(getLblTopSelling(), gbc_lblTopSelling);
			GridBagConstraints gbc_lblProdName = new GridBagConstraints();
			gbc_lblProdName.insets = new Insets(0, 0, 5, 5);
			gbc_lblProdName.gridx = 1;
			gbc_lblProdName.gridy = 1;
			productPanel.add(getLblProdName(), gbc_lblProdName);
			GridBagConstraints gbc_lblProdQuan = new GridBagConstraints();
			gbc_lblProdQuan.insets = new Insets(0, 0, 5, 5);
			gbc_lblProdQuan.gridx = 1;
			gbc_lblProdQuan.gridy = 2;
			productPanel.add(getLblProdQuan(), gbc_lblProdQuan);
			GridBagConstraints gbc_lblProdUnitPrice = new GridBagConstraints();
			gbc_lblProdUnitPrice.insets = new Insets(0, 0, 5, 5);
			gbc_lblProdUnitPrice.gridx = 1;
			gbc_lblProdUnitPrice.gridy = 3;
			productPanel.add(getLblProdUnitPrice(), gbc_lblProdUnitPrice);
			GridBagConstraints gbc_lblProdTotalPrice = new GridBagConstraints();
			gbc_lblProdTotalPrice.insets = new Insets(0, 0, 5, 5);
			gbc_lblProdTotalPrice.gridx = 1;
			gbc_lblProdTotalPrice.gridy = 4;
			productPanel.add(getLblProdTotalPrice(), gbc_lblProdTotalPrice);
		}
		return productPanel;
	}
	public JPanel getProductStatistics() {
		if (productStatistics == null) {
			productStatistics = new JPanel();
			GridBagLayout gbl_productStatistics = new GridBagLayout();
			gbl_productStatistics.columnWidths = new int[] {0, 70, 30, 30, 80, 30, 80, 21, 0, 0};
			gbl_productStatistics.rowHeights = new int[] {0, 234, 23, 30, 30, 30};
			gbl_productStatistics.columnWeights = new double[]{1.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, Double.MIN_VALUE};
			gbl_productStatistics.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0};
			productStatistics.setLayout(gbl_productStatistics);
			GridBagConstraints gbc_labelPanel = new GridBagConstraints();
			gbc_labelPanel.insets = new Insets(0, 0, 5, 5);
			gbc_labelPanel.fill = GridBagConstraints.BOTH;
			gbc_labelPanel.gridx = 1;
			gbc_labelPanel.gridy = 1;
			productStatistics.add(getLabelPanel(), gbc_labelPanel);
			GridBagConstraints gbc_panel = new GridBagConstraints();
			gbc_panel.gridwidth = 5;
			gbc_panel.insets = new Insets(0, 0, 13, 5);
			gbc_panel.fill = GridBagConstraints.BOTH;
			gbc_panel.gridx = 2;
			gbc_panel.gridy = 1;
			productStatistics.add(getPanel(), gbc_panel);
			GridBagConstraints gbc_lblRightArrow = new GridBagConstraints();
			gbc_lblRightArrow.insets = new Insets(0, 0, 5, 5);
			gbc_lblRightArrow.fill = GridBagConstraints.BOTH;
			gbc_lblRightArrow.gridx = 7;
			gbc_lblRightArrow.gridy = 1;
			productStatistics.add(getLblRightArrow(), gbc_lblRightArrow);
			GridBagConstraints gbc_lblSales = new GridBagConstraints();
			gbc_lblSales.fill = GridBagConstraints.BOTH;
			gbc_lblSales.gridwidth = 3;
			gbc_lblSales.insets = new Insets(0, 0, 5, 5);
			gbc_lblSales.gridx = 5;
			gbc_lblSales.gridy = 2;
			productStatistics.add(getLblSales(), gbc_lblSales);
			GridBagConstraints gbc_lblLegend = new GridBagConstraints();
			gbc_lblLegend.anchor = GridBagConstraints.WEST;
			gbc_lblLegend.gridwidth = 3;
			gbc_lblLegend.insets = new Insets(0, 0, 5, 5);
			gbc_lblLegend.gridx = 2;
			gbc_lblLegend.gridy = 3;
			productStatistics.add(getLblLegend(), gbc_lblLegend);
			GridBagConstraints gbc_lblDecoKey = new GridBagConstraints();
			gbc_lblDecoKey.fill = GridBagConstraints.BOTH;
			gbc_lblDecoKey.insets = new Insets(0, 0, 5, 5);
			gbc_lblDecoKey.gridx = 2;
			gbc_lblDecoKey.gridy = 4;
			productStatistics.add(getLblDecoKey(), gbc_lblDecoKey);
			GridBagConstraints gbc_lblDecorations = new GridBagConstraints();
			gbc_lblDecorations.gridwidth = 2;
			gbc_lblDecorations.anchor = GridBagConstraints.WEST;
			gbc_lblDecorations.insets = new Insets(0, 0, 5, 5);
			gbc_lblDecorations.gridx = 3;
			gbc_lblDecorations.gridy = 4;
			productStatistics.add(getLblDecorations(), gbc_lblDecorations);
			GridBagConstraints gbc_lblHandiKey = new GridBagConstraints();
			gbc_lblHandiKey.fill = GridBagConstraints.BOTH;
			gbc_lblHandiKey.insets = new Insets(0, 0, 5, 5);
			gbc_lblHandiKey.gridx = 5;
			gbc_lblHandiKey.gridy = 4;
			productStatistics.add(getLblHandiKey(), gbc_lblHandiKey);
			GridBagConstraints gbc_lblHandicrafts = new GridBagConstraints();
			gbc_lblHandicrafts.anchor = GridBagConstraints.WEST;
			gbc_lblHandicrafts.insets = new Insets(0, 0, 5, 5);
			gbc_lblHandicrafts.gridx = 6;
			gbc_lblHandicrafts.gridy = 4;
			productStatistics.add(getLblHandicrafts(), gbc_lblHandicrafts);
			GridBagConstraints gbc_lblPotKey = new GridBagConstraints();
			gbc_lblPotKey.fill = GridBagConstraints.BOTH;
			gbc_lblPotKey.insets = new Insets(0, 0, 0, 5);
			gbc_lblPotKey.gridx = 2;
			gbc_lblPotKey.gridy = 5;
			productStatistics.add(getLblPotKey(), gbc_lblPotKey);
			GridBagConstraints gbc_lblPottery = new GridBagConstraints();
			gbc_lblPottery.gridwidth = 2;
			gbc_lblPottery.anchor = GridBagConstraints.WEST;
			gbc_lblPottery.insets = new Insets(0, 0, 0, 5);
			gbc_lblPottery.gridx = 3;
			gbc_lblPottery.gridy = 5;
			productStatistics.add(getLblPottery(), gbc_lblPottery);
			GridBagConstraints gbc_lblSewKey = new GridBagConstraints();
			gbc_lblSewKey.fill = GridBagConstraints.BOTH;
			gbc_lblSewKey.insets = new Insets(0, 0, 0, 5);
			gbc_lblSewKey.gridx = 5;
			gbc_lblSewKey.gridy = 5;
			productStatistics.add(getLblSewKey(), gbc_lblSewKey);
			GridBagConstraints gbc_lblSewing = new GridBagConstraints();
			gbc_lblSewing.anchor = GridBagConstraints.WEST;
			gbc_lblSewing.insets = new Insets(0, 0, 0, 5);
			gbc_lblSewing.gridx = 6;
			gbc_lblSewing.gridy = 5;
			productStatistics.add(getLblSewing(), gbc_lblSewing);
		}
		return productStatistics;
	}
	public JPanel getPanel() {
		if (panel == null) {
			panel = new JPanel();
			panel.setBorder(new MatteBorder(0, 2, 2, 0, (Color) Color.BLACK));
			panel.setLayout(new GridLayout(9, 1, 0, 0));
			panel.add(getPanel_1());
			panel.add(getDecoHolder());
			panel.add(getPanel_3());
			panel.add(getHandiHolder());
			panel.add(getPanel_5());
			panel.add(getPotHolder());
			panel.add(getPanel_7());
			panel.add(getSewHolder());
			panel.add(getPanel_9());
		}
		return panel;
	}
	public JLabel getLblRightArrow() {
		if (lblRightArrow == null) {
			lblRightArrow = new JLabel(">");
			lblRightArrow.setFont(new Font("Tahoma", Font.BOLD, 15));
			lblRightArrow.setHorizontalAlignment(SwingConstants.CENTER);
			lblRightArrow.setVerticalAlignment(SwingConstants.BOTTOM);
		}
		return lblRightArrow;
	}
	public JLabel getLblSales() {
		if (lblSales == null) {
			lblSales = new JLabel("Sales");
			lblSales.setFont(new Font("Tahoma", Font.BOLD, 12));
			lblSales.setHorizontalAlignment(SwingConstants.RIGHT);
			lblSales.setVerticalAlignment(SwingConstants.TOP);
		}
		return lblSales;
	}
	public JLabel getLblLegend() {
		if (lblLegend == null) {
			lblLegend = new JLabel("Legend");
			lblLegend.setVerticalAlignment(SwingConstants.BOTTOM);
			lblLegend.setFont(new Font("Tahoma", Font.BOLD, 15));
			lblLegend.setBorder(new MatteBorder(0, 0, 1, 0, (Color) Color.WHITE));
		}
		return lblLegend;
	}
	public JLabel getLblDecoKey() {
		if (lblDecoKey == null) {
			lblDecoKey = new JLabel("");
			lblDecoKey.setBackground(Color.CYAN);
			lblDecoKey.setOpaque(true);
			lblDecoKey.setPreferredSize(new Dimension(20, 20));
		}
		return lblDecoKey;
	}
	public JLabel getLblDecorations() {
		if (lblDecorations == null) {
			lblDecorations = new JLabel("Decorations");
			lblDecorations.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblDecorations;
	}
	public JLabel getLblHandiKey() {
		if (lblHandiKey == null) {
			lblHandiKey = new JLabel("");
			lblHandiKey.setBackground(Color.GREEN);
			lblHandiKey.setOpaque(true);
			lblHandiKey.setPreferredSize(new Dimension(20, 20));
		}
		return lblHandiKey;
	}
	public JLabel getLblHandicrafts() {
		if (lblHandicrafts == null) {
			lblHandicrafts = new JLabel("Handicrafts");
			lblHandicrafts.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblHandicrafts;
	}
	public JLabel getLblPotKey() {
		if (lblPotKey == null) {
			lblPotKey = new JLabel("");
			lblPotKey.setBackground(Color.ORANGE);	
			lblPotKey.setOpaque(true);
			lblPotKey.setPreferredSize(new Dimension(20, 20));
		}
		return lblPotKey;
	}
	public JLabel getLblPottery() {
		if (lblPottery == null) {
			lblPottery = new JLabel("Pottery");
			lblPottery.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblPottery;
	}
	public JLabel getLblSewKey() {
		if (lblSewKey == null) {
			lblSewKey = new JLabel("");
			lblSewKey.setBackground(Color.RED);
			lblSewKey.setOpaque(true);
			lblSewKey.setPreferredSize(new Dimension(20, 20));
		}
		return lblSewKey;
	}
	public JLabel getLblSewing() {
		if (lblSewing == null) {
			lblSewing = new JLabel("Sewing");
			lblSewing.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblSewing;
	}
	public JPanel getPanel_1() {
		if (panel_1 == null) {
			panel_1 = new JPanel();
		}
		return panel_1;
	}
	public JPanel getDecoHolder() {
		if (decoHolder == null) {
			decoHolder = new JPanel();
			decoHolder.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
			decoHolder.setBorder(null);
			decoHolder.add(getLblDecoStat());
			decoHolder.add(getLblDecoStatDetails());
		}
		return decoHolder;
	}
	public JPanel getPanel_3() {
		if (panel_3 == null) {
			panel_3 = new JPanel();
		}
		return panel_3;
	}
	public JPanel getHandiHolder() {
		if (handiHolder == null) {
			handiHolder = new JPanel();
			handiHolder.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
			handiHolder.setBorder(null);
			handiHolder.add(getLblHandiStat());
			handiHolder.add(getLblHandiStatDetails());
		}
		return handiHolder;
	}
	public JPanel getPanel_5() {
		if (panel_5 == null) {
			panel_5 = new JPanel();
		}
		return panel_5;
	}
	public JPanel getPotHolder() {
		if (potHolder == null) {
			potHolder = new JPanel();
			potHolder.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
			potHolder.setBorder(null);
			potHolder.add(getLblPotStat());
			potHolder.add(getLblPotStatDetails());
		}
		return potHolder;
	}
	public JPanel getPanel_7() {
		if (panel_7 == null) {
			panel_7 = new JPanel();
		}
		return panel_7;
	}
	public JPanel getSewHolder() {
		if (sewHolder == null) {
			sewHolder = new JPanel();
			sewHolder.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 0));
			sewHolder.setBorder(null);
			sewHolder.add(getLblSewStat());
			sewHolder.add(getLblSewStatDetails());
		}
		return sewHolder;
	}
	public JPanel getPanel_9() {
		if (panel_9 == null) {
			panel_9 = new JPanel();
		}
		return panel_9;
	}
	public JLabel getLblDecoStat() {
		if (lblDecoStat == null) {
			lblDecoStat = new JLabel("");
			lblDecoStat.setOpaque(true);
			lblDecoStat.setBackground(Color.CYAN);
			lblDecoStat.setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[0] / (double)control.getReport().getTotalQuantity()) * 233), 24));
		}
		return lblDecoStat;
	}
	public JLabel getLblDecoStatDetails() {
		if (lblDecoStatDetails == null) {
			lblDecoStatDetails = new JLabel();
			lblDecoStatDetails.setText("Qty: " + control.getReport().getQuantity()[0] + ", Total: $" + control.getReport().getSales()[0]);
			lblDecoStatDetails.setPreferredSize(new Dimension(110, 30));
			lblDecoStatDetails.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblDecoStatDetails;
	}
	public JLabel getLblHandiStat() {
		if (lblHandiStat == null) {
			lblHandiStat = new JLabel("");
			lblHandiStat.setOpaque(true);
			lblHandiStat.setBackground(Color.GREEN);
			lblHandiStat.setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[1] / (double)control.getReport().getTotalQuantity()) * 233), 24));
		}
		return lblHandiStat;
	}
	public JLabel getLblHandiStatDetails() {
		if (lblHandiStatDetails == null) {
			lblHandiStatDetails = new JLabel();
			lblHandiStatDetails.setText("Qty: " + control.getReport().getQuantity()[1] + ", Total: $" + control.getReport().getSales()[1]);
			lblHandiStatDetails.setPreferredSize(new Dimension(110, 30));
			lblHandiStatDetails.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblHandiStatDetails;
	}
	public JLabel getLblPotStat() {
		if (lblPotStat == null) {
			lblPotStat = new JLabel("");
			lblPotStat.setOpaque(true);
			lblPotStat.setBackground(Color.ORANGE);
			lblPotStat.setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[2] / (double)control.getReport().getTotalQuantity()) * 233), 24));
		}
		return lblPotStat;
	}
	public JLabel getLblPotStatDetails() {
		if (lblPotStatDetails == null) {
			lblPotStatDetails = new JLabel();
			lblPotStatDetails.setText("Qty: " + control.getReport().getQuantity()[2] + ", Total: $" + control.getReport().getSales()[2]);
			lblPotStatDetails.setPreferredSize(new Dimension(110, 30));
			lblPotStatDetails.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblPotStatDetails;
	}
	public JLabel getLblSewStat() {
		if (lblSewStat == null) {
			lblSewStat = new JLabel("");
			lblSewStat.setOpaque(true);
			lblSewStat.setBackground(Color.RED);
			if(control.getReport().getQuantity()[3] != 0){
				lblSewStat.setPreferredSize(new Dimension((int)(((double)control.getReport().getQuantity()[3] / (double)control.getReport().getTotalQuantity()) * 233), 24));
			}
		}
		return lblSewStat;
	}
	public JLabel getLblSewStatDetails() {
		if (lblSewStatDetails == null) {
			lblSewStatDetails = new JLabel();
			lblSewStatDetails.setText("Qty: " + control.getReport().getQuantity()[3] + ", Total: $" + control.getReport().getSales()[3]);
			lblSewStatDetails.setPreferredSize(new Dimension(110, 30));
			lblSewStatDetails.setHorizontalAlignment(SwingConstants.RIGHT);
		}
		return lblSewStatDetails;
	}
	public JScrollPane getItemScrollPane() {
		if (itemScrollPane == null) {
			itemScrollPane = new JScrollPane();
			itemScrollPane.setPreferredSize(new Dimension(380, 395));
			itemScrollPane.setViewportView(getItemPanel());
		}
		return itemScrollPane;
	}
	public JPanel getItemPanel() {
		if (itemPanel == null) {
			itemPanel = new JPanel();
		}
		return itemPanel;
	}
	public JScrollPane getWorkshopScrollPane() {
		if (workshopScrollPane == null) {
			workshopScrollPane = new JScrollPane();
			workshopScrollPane.setViewportView(getPastWorkshopsPanel());
			workshopScrollPane.setPreferredSize(new Dimension(160, 250));
		}
		return workshopScrollPane;
	}
	public JPanel getWorkshopStatistics() {
		if (workshopStatistics == null) {
			workshopStatistics = new JPanel();
			FlowLayout flowLayout = (FlowLayout) workshopStatistics.getLayout();
			flowLayout.setAlignment(FlowLayout.RIGHT);
		}
		return workshopStatistics;
	}
	public JPanel getPastWorkshopsPanel() {
		if (pastWorkshopsPanel == null) {
			pastWorkshopsPanel = new JPanel();
		}
		return pastWorkshopsPanel;
	}
	public JPanel getLabelPanel() {
		if (labelPanel == null) {
			labelPanel = new JPanel();
			GridBagLayout gbl_labelPanel = new GridBagLayout();
			gbl_labelPanel.columnWidths = new int[]{0, 0, 0};
			gbl_labelPanel.rowHeights = new int[] {30, 0, 30, 0, 30, 0, 30, 0, 0};
			gbl_labelPanel.columnWeights = new double[]{1.0, 0.0, Double.MIN_VALUE};
			gbl_labelPanel.rowWeights = new double[]{0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0};
			labelPanel.setLayout(gbl_labelPanel);
			GridBagConstraints gbc_lblDeco = new GridBagConstraints();
			gbc_lblDeco.anchor = GridBagConstraints.EAST;
			gbc_lblDeco.insets = new Insets(0, 0, 3, 0);
			gbc_lblDeco.gridx = 1;
			gbc_lblDeco.gridy = 1;
			labelPanel.add(getLblDeco(), gbc_lblDeco);
			GridBagConstraints gbc_lblHandi = new GridBagConstraints();
			gbc_lblHandi.anchor = GridBagConstraints.EAST;
			gbc_lblHandi.gridx = 1;
			gbc_lblHandi.gridy = 3;
			labelPanel.add(getLblHandi(), gbc_lblHandi);
			GridBagConstraints gbc_lblPot = new GridBagConstraints();
			gbc_lblPot.anchor = GridBagConstraints.EAST;
			gbc_lblPot.insets = new Insets(0, 0, 3, 0);
			gbc_lblPot.gridx = 1;
			gbc_lblPot.gridy = 5;
			labelPanel.add(getLblPot(), gbc_lblPot);
			GridBagConstraints gbc_lblSew = new GridBagConstraints();
			gbc_lblSew.anchor = GridBagConstraints.EAST;
			gbc_lblSew.insets = new Insets(0, 0, 5, 0);
			gbc_lblSew.gridx = 1;
			gbc_lblSew.gridy = 7;
			labelPanel.add(getLblSew(), gbc_lblSew);
		}
		return labelPanel;
	}
	public JLabel getLblDeco() {
		if (lblDeco == null) {
			lblDeco = new JLabel("Decorations");
			lblDeco.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblDeco;
	}
	public JLabel getLblHandi() {
		if (lblHandi == null) {
			lblHandi = new JLabel("Handicrafts");
			lblHandi.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblHandi;
	}
	public JLabel getLblPot() {
		if (lblPot == null) {
			lblPot = new JLabel("Pottery");
			lblPot.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblPot;
	}
	public JLabel getLblSew() {
		if (lblSew == null) {
			lblSew = new JLabel("Sewing");
			lblSew.setFont(new Font("Tahoma", Font.PLAIN, 13));
		}
		return lblSew;
	}
	public JLabel getLblTopSelling() {
		if (lblTopSelling == null) {
			lblTopSelling = new JLabel("Top Selling");
			lblTopSelling.setForeground(Color.RED);
			lblTopSelling.setFont(new Font("Tahoma", Font.BOLD, 20));
		}
		return lblTopSelling;
	}
	public JLabel getLblProdName() {
		if (lblProdName == null) {
			lblProdName = new JLabel("");
			lblProdName.setFont(new Font("Tahoma", Font.BOLD, 18));
		}
		return lblProdName;
	}
	public JLabel getLblProdQuan() {
		if (lblProdQuan == null) {
			lblProdQuan = new JLabel("");
			lblProdQuan.setFont(new Font("Tahoma", Font.PLAIN, 15));
		}
		return lblProdQuan;
	}
	public JLabel getLblProdUnitPrice() {
		if (lblProdUnitPrice == null) {
			lblProdUnitPrice = new JLabel("");
			lblProdUnitPrice.setFont(new Font("Tahoma", Font.PLAIN, 15));
		}
		return lblProdUnitPrice;
	}
	public JLabel getLblProdTotalPrice() {
		if (lblProdTotalPrice == null) {
			lblProdTotalPrice = new JLabel("");
			lblProdTotalPrice.setFont(new Font("Tahoma", Font.PLAIN, 15));
		}
		return lblProdTotalPrice;
	}
	public JLabel getLblCategory() {
		if (lblCategory == null) {
			lblCategory = new JLabel("");
			lblCategory.setFont(new Font("Tahoma", Font.PLAIN, 20));
		}
		return lblCategory;
	}
}
